local EntityEffectController = class("EntityEffectController")

function EntityEffectController:ctor(view)
	self.view = view
	self.curEffect = Enums.BuffEffects.None
end

function EntityEffectController:apply(effect)
	if self.curEffect==effect then
		return 
	end
	self.curEffect = effect

	--rint(">>>>>EntityEffectController apply "..(effect or "null"))
	self:applyNone()

	if effect == Enums.BuffEffects.Stone then
		self:applyStone()
	elseif effect == Enums.BuffEffects.Poison then
		self:applyPoison()
	elseif effect == Enums.BuffEffects.Cold then
		self:applyCold()
	elseif effect == Enums.BuffEffects.Fire then
		self:applyFire()
	elseif effect == Enums.BuffEffects.Red then
		self:applyRed()
	elseif effect == Enums.BuffEffects.Purple then
		self:applyPurple()
	end
end

function EntityEffectController:applyNone()
    self.view:applyShader(nil)
	self.view:setEffectColor(nil)
end

function EntityEffectController:applyStone()
	self.view:applyShader("Stone")
end

function EntityEffectController:applyPoison()
	self.view:applyShader("Poison")
end

function EntityEffectController:applyCold()
	self.view:applyShader("Frozen")
end

function EntityEffectController:applyFire()
	self.view:applyShader("Fire")
end


function EntityEffectController:applyRed()
	self.view:applyShader("Red")
end

function EntityEffectController:applyPurple()
	-- cc.c3b(70*1.5,37*1.5,101*1.5)
	self.view:setEffectColor(cc.c3b(105,55,151))
end

return EntityEffectController